package xyz.scootaloo.oj.leetcode

import org.junit.Test
import xyz.scootaloo.common.TestDsl
import java.util.*

/**
 * @author flutterdash@qq.com
 * @since 2021/7/2 20:36
 */
class P1137 : TestDsl {

    private fun tribonacci(n: Int): Int {
        val dp = IntArray(40)
        dp[0] = 0
        dp[1] = 1
        dp[2] = 1
        dp[3] = 2
        if (n <= 3)
            return dp[n]
        for (i in 4..n)
            dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3]
        return dp[n]
    }

    fun sum(a: Int, b: Int, c: Int) = (a + b + c)

    @Test
    fun test0() {
        tribonacci(0) shouldBe 0
        tribonacci(1) shouldBe 1
        tribonacci(2) shouldBe 1
        tribonacci(25) shouldBe 1389537
    }

}
